package com.zgscwjm.taobaphelper.data;

import com.zgscwjm.taobaphelper.exutils.MyBaseConfig;

/**
 * Created by fukunaka on 2017/3/15.
 */

public class AccountBean {
    String rawpassword;
    String rawpaycode;
    String rawusername;
    String realPaycode;
    String realPswd;
    String realname;

    public AccountBean(String rawusername, String rawpassword, String rawpaycode, String realname, String realPswd, String realPaycode) {
        this.rawpassword = rawpassword;
        this.rawpaycode = rawpaycode;
        this.rawusername = rawusername;
        this.realPaycode = realPaycode;
        this.realPswd = realPswd;
        this.realname = realname;
    }

    public String getRawpassword() {
        return rawpassword;
    }

    public void setRawpassword(String rawpassword) {
        this.rawpassword = rawpassword;
    }

    public String getRawpaycode() {
        return rawpaycode;
    }

    public void setRawpaycode(String rawpaycode) {
        this.rawpaycode = rawpaycode;
    }

    public String getRawusername() {
        return rawusername;
    }

    public void setRawusername(String rawusername) {
        this.rawusername = rawusername;
    }

    public String getRealPaycode() {
        return realPaycode;
    }

    public void setRealPaycode(String realPaycode) {
        this.realPaycode = realPaycode;
    }

    public String getRealPswd() {
        return realPswd;
    }

    public void setRealPswd(String realPswd) {
        this.realPswd = realPswd;
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public AccountBean(String rawusername, String rawpassword) {
        this.rawpassword = rawpassword;
        this.rawusername = rawusername;
    }

    public AccountBean(String rawusername, String rawpassword, String realname, String realPswd) {
        this.rawpassword = rawpassword;
        this.rawusername = rawusername;
        this.realPswd = realPswd;
        this.realname = realname;
    }

    public AccountBean(boolean b,String str,String str1,String str2){
        if (b)
        {
            this.realname=str;
            this.realPswd=str1;
            this.realPaycode=str2;
        }
        else
        {
            this.rawusername=str;
            this.rawpassword=str1;
            this.rawpaycode=str2;
        }

    }

    public AccountBean() {
    }

    public void decrypt(String str){
        String str2=str+MyBaseConfig.AccountBean_Key;
        try {
            this.realname=PrivateKey.DecryptPrivate(this.rawusername,str2);
            this.realPswd=PrivateKey.DecryptPrivate(this.rawpassword,str2);
            this.realPaycode=PrivateKey.DecryptPrivate(this.rawpaycode,str2);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    public void decryptRealName(String str)
    {
        try {
            this.rawusername=PrivateKey.EncryptPrivate(this.realname,str+ MyBaseConfig.AccountBean_Key);

        }catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    public void encrypt(String str)
    {
        String str2=str+MyBaseConfig.AccountBean_Key;
        try {
          this.rawusername=PrivateKey.EncryptPrivate(this.realname,str2);
            this.rawpassword=PrivateKey.EncryptPrivate(this.realPswd,str2);
            this.rawpaycode=PrivateKey.EncryptPrivate(this.realPaycode,str2);

        }
        catch (Exception e)
        {
      e.printStackTrace();
        }
        this.realname=null;
        this.realPswd=null;
        this.realPaycode=null;

    }
    public void encryptRealNmae(String str){
        try {
            this.rawusername= PrivateKey.EncryptPrivate(this.realname,str+MyBaseConfig.AccountBean_Key);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    @Override
    public String toString() {
        return "AccountBean{" +
                "rawpassword='" + rawpassword + '\'' +
                ", rawpaycode='" + rawpaycode + '\'' +
                ", rawusername='" + rawusername + '\'' +
                ", realPaycode='" + realPaycode + '\'' +
                ", realPswd='" + realPswd + '\'' +
                ", realname='" + realname + '\'' +
                '}';
    }
}
